<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>专题列表 - Powered By BETOU.NET</title>
<meta name="author" content="BETOU.NET Team" />
<meta name="copyright" content="BETOU.NET" />
<link href="${base}/res/betou/css/common.css" rel="stylesheet" type="text/css"/>
<link href="${base}/res/betou/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/res/common/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="${base}/res/common/js/common.js"></script>
<script src="${base}/res/betou/js/list.js" type="text/javascript"></script>

<script type="text/javascript">
$().ready(function() {

	var $listForm = $("#listForm");
	var $filterSelect = $("#filterSelect");
	var $filterOption = $("#filterOption a");
	var $priorityButton = $("#priorityButton");
	
	$filterSelect.mouseover(function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 筛选选项
	$filterOption.click(function() {
		var $this = $(this);
		var $dest = $("#" + $this.attr("name"));
		if ($this.hasClass("checked")) {
			$dest.val("");
		} else {
			$dest.val($this.attr("val"));
		}
		$listForm.submit();
		return false;
	});
	
	var filterStatus = "${filterStatus!}";
	$.each($filterOption,function(i,e){
		var $this = $(this);
		if( $this.attr("val") == filterStatus ){
			$this.addClass("checked");
		}
	});
	
	$priorityButton.click( function( ){
		if ($(this).hasClass("disabled")) {
			return false;
		}
		
		$listForm.attr( "action", "o_priority.do");
		$listForm.submit( );
	})
	
	$("input[name*=priority]").focus(function(){
		$(this).select();
	}).blur( function( ){
		var isDisabled = 0;
		$("input[name*=priority]").each( function( i, e ){
			var eachVal = $(this).val();
			if( !/^\d+$/.test( eachVal ) ){
				$.message("warn", "请填写数字！");
				$priorityButton.addClass("disabled");
				isDisabled++;
				return;
			}
		});
		if( isDisabled == 0 ){
			$priorityButton.removeClass("disabled");
		}
		
	})
	
});
</script>
</head>
<body>
	<div class="path">
		<a href="../right.do">首页</a> &raquo; 专题列表 <span>(共<span id="pageTotal">${pagination.totalCount}</span>条记录)</span>
	</div>
	<form id="listForm" action="v_list.do" method="post">
		<div class="bar">
			<a class="iconButton" href="v_add.do"><span class="addIcon"> </span>添加 </a>
			<div class="buttonWrap">
			
				<a href="javascript:;" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>删除
				</a>
				
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>刷新
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="filterSelect" class="button">
						状态<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="filterOption" class="check">
							<li><a href="javascript:;" name="filterStatus" val="recommend,true,bool" >推荐</a></li>
							<li><a href="javascript:;" name="filterStatus" val="recommend,false,bool">不推荐</a></li>
						</ul>
					</div>
				</div>
				
				<#include "../pageselect.html"/>
				<a href="javascript:;" id="priorityButton" class="button">保存顺序</a>
			</div>
			<div class="menuWrap">
				<div class="search">
					<span id="searchPropertySelect" class="arrow">&nbsp;</span>
					<input type="text" id="searchValue" name="searchValue" value="${searchValue!}" maxlength="200" />
					<button type="submit">&nbsp;</button>
				</div>
				<div class="popupMenu">
					<ul id="searchPropertyOption">
						<li><a href="javascript:;" val="name">名称</a></li>
					</ul>
				</div>
			</div>
			
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				<th>
					<a href="javascript:;" class="sort" name="id">编号</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="name"><@s.m "cmsTopic.name" /></a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="lastUpdate">最后更新</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="channel.id"><@s.m "cmsTopic.channel" /></a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="priority"><@s.m "cmsTopic.priority" /></a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="recommend"><@s.m "cmsTopic.recommend"/></a>
				</th>
				
				<th>
					<span>操作</span>
				</th>
			</tr>
			<#list pagination.list as cmsTopic>
			<tr>
				<td><input type="checkbox" name="ids" value="${cmsTopic.id}" /></td>
				<td>${cmsTopic.id}</td>
				<td>
					${cmsTopic.name} <#if cmsTopic.shortName??>[${cmsTopic.shortName}]</#if>
				</td>
				<td>
					${cmsTopic.lastUpdate?string("yyyy-MM-dd hh:MM:ss")}
				</td>
				<td>
					<#if cmsTopic.channel??>
						<#list cmsTopic.channel.nodeList as c>${c.name}<#if c_has_next> > </#if></#list><#t/>
					</#if>
				</td>
				<td>
						<input type="text" name="priority" value="${cmsTopic.priority}" class="text" style="width:40px;text-align:center"/>
						<input type="hidden" name="wids" value="${cmsTopic.id}"/>
				</td>
				<td>
					<#if cmsTopic.recommend>
					<span class="trueIcon">&nbsp;</span>
					<#else>
					<span class="falseIcon">&nbsp;</span>
					</#if>
				</td>
				<td>
					<a href="v_edit.do?id=${cmsTopic.id!}" >[<@s.m "global.edit"/>]</a>
				</td>
				</tr>
			</#list>
		</table>
		<#include "../list_hidden.html"/>
		<#include "../page.html" />
	</form>

</body>
</html>
<#include "/common/alert_message.html"/>
